package com.xipu.yygh.common.utils;

import javax.servlet.http.HttpServletRequest;

/**
 * description: 从请求头获取token,再从token获取信息
 * @author: gql
 * @date: 2021/11
 */
public class HeadJwtHelper {
    /**
     * 从请求头获取token,再从token获取userId
     * @param request 请求
     * @return userId
     */
    public static Long getUserId(HttpServletRequest request) {
        return JwtHelper.getUserId(request.getHeader("token"));
    }

    /**
     * 从请求头获取token,再从token获取userName
     * @param request 请求
     * @return userName
     */
    public static String getUserName(HttpServletRequest request) {
        return JwtHelper.getUserName(request.getHeader("token"));
    }
}
